<extend name="layout" />

<block name="body">
<body class="details_bg">
	<div class="main_visual">
	<div class="flicking_con">
		<volist name="gift.pics" id="vo">
			<a href="#"></a>
		</volist>
	</div>
	<div class="main_image">
		<ul>
			<volist name="gift.pics" id="vo">
			<li><span style="background:url('{$vo|mime_uri_format}') no-repeat scroll center top / cover "></span></li>
			</volist>
		</ul><!-- 
		<a href="javascript:;" id="btn_prev"></a>
		<a href="javascript:;" id="btn_next"></a> -->
	</div>
</div>
<div class="pb20 wh ov">
	<div class="details_Box details_Box1">
		<a class="JS-exchange">立即兑换</a><span>{$gift.score}</span><font><img src="__PUBLIC__/App/images/details_mony.png"></font>
	</div>
	<div class="details_Box details_Box2">
		<a class="JS-exchange">立即兑换</a><span>{$gift.score}</span><font><img src="__PUBLIC__/App/images/details_mony.png"></font>
	</div>
	<div class="details_content">
		<div class="details_tt">
			<span>商品简介：</span>
		</div>
		<div class="wh details_txt">{$gift.content}</div>
		<div class="wh details_ts">龙渊说：觉得商品棒棒哒，点击商品详情页右上角按钮，分享给小伙伴们吧！</div>
		<div class="details_tt">
			<span>兑换流程：</span>
		</div>
		<div class="wh details_txt">{$gift.flow}</div>
		<div class="wh details_ft">
			<div class="tt"><span><font>重要说明</font></span></div>
			<div class="bd">
				<div class="txt">{$gift.explain}</div>
			</div>
			<div class="txt1">活动由龙渊网络提供，与游戏公司无关</div>
		</div>
	</div>
</div>
</div>
</block>


<block name="script">
<script type="text/javascript">
$(document).ready(function(){

	$(".main_visual").hover(function(){
		$("#btn_prev,#btn_next").fadeIn()
	},function(){
		$("#btn_prev,#btn_next").fadeOut()
	});
	
	$dragBln = false;
	
	$(".main_image").touchSlider({
		flexible : true,
		speed : 200,
		btn_prev : $("#btn_prev"),
		btn_next : $("#btn_next"),
		paging : $(".flicking_con a"),
		counter : function (e){
			$(".flicking_con a").removeClass("on").eq(e.current-1).addClass("on");
		}
	});
	
	$(".main_image").bind("mousedown", function() {
		$dragBln = false;
	});
	
	$(".main_image").bind("dragstart", function() {
		$dragBln = true;
	});
	
	$(".main_image a").click(function(){
		if($dragBln) {
			return false;
		}
	});
	
	timer = setInterval(function(){
		$("#btn_next").click();
	}, 5000);
	
	$(".main_visual").hover(function(){
		clearInterval(timer);
	},function(){
		timer = setInterval(function(){
			$("#btn_next").click();
		},5000);
	});
	
	$(".main_image").bind("touchstart",function(){
		clearInterval(timer);
	}).bind("touchend", function(){
		timer = setInterval(function(){
			$("#btn_next").click();
		}, 5000);
	});

	var gift_id = {$gift.id|default=0};
	var user_token = '{$user.appToken|default=""}';
	var exchange_uri = '//www.66tv.tv/api/gift/exchange';
	$('.JS-exchange').click(function(){
		$.post(exchange_uri, {id: gift_id, appToken: user_token}, function(res){
			if (res.code != 200)
			{
				alert(res.info);
			}
			else
			{
				alert('兑换成功, 请到积分记录查看获取的礼品码');
			}
		});
	});
	
});
</script>
</block>


